<template>
  <div class="detail-content">
    <div class="detail-content-top">
      <div style="position: relative">
        <div class="thing-infos-view">
          <div class="thing-infos">
            <div class="thing-img-box">
              <img :src="detailData.cover" />
            </div>
            <div class="thing-info-box">
              <div class="thing-state">
                <span class="state hidden-sm">商品状态</span>
                <span>{{
                  detailData.status === "1" ? "上市销售" : "已下架"
                }}</span>
              </div>
              <h1 class="thing-name">{{ detailData.title }}</h1>
              <span>
                <span class="a-price-symbol">¥</span>
                <span class="a-price">{{ detailData.price }}</span>
              </span>
              <div class="translators flex-view" style="">
                <span>分类：</span>
                <span class="name">{{ detailData.classification_title }}</span>
              </div>
              <div class="translators flex-view" style="">
                <span>库存：</span>
                <span class="name">{{ detailData.repertory }}</span>
              </div>
              <button class="buy-btn" @click="handleOrder(detailData)">
                <span>立即购买</span>
              </button>
<!-- 
              <button class="buy-btn" @click="getThings">
                <span>测试</span>
              </button> -->
            </div>
          </div>
          <div class="thing-counts hidden-sm">
            <div class="count-item flex-view pointer" @click="addToWish()">
              <div class="count-box flex-view">
                <div class="count-text-box" @click="AddToWish">
                  <span class="count-title">
                    <el-icon><CirclePlusFilled /></el-icon> 加入心愿单</span
                  >
                </div>
                <div class="count-num-box">
                  <span class="num-text">{{ detailData.wishCount }}</span>
                </div>
              </div>
            </div>
            <div
              class="count-item flex-view pointer"
              @click="addToCollection()"
            >
              <div class="count-box flex-view">
                <div class="count-text-box">
                  <span class="count-title"
                    ><el-icon><Share /></el-icon> 收藏</span
                  >
                </div>
                <div class="count-num-box">
                  <span class="num-text">{{ detailData.collectCount }}</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="detail-content-bottom">
      <div class="thing-content-view flex-view">
        <div class="main-content">
          <div class="order-view main-tab">
            <el-radio-group v-model="radio">
              <el-radio-button
                @click="onTagChange('简介')"
                label="简介"
                value="简介"
              />
              <el-radio-button
                @click="onTagChange('评论')"
                label="评论"
                value="评论"
              />
            </el-radio-group>
          </div>

          <!--简介-->
          <div class="thing-intro" :class="radio != '评论' ? '' : 'hide'">
            <p class="text" style="">{{ detailData.description }}</p>
          </div>

          <!--评论-->
          <div class="thing-comment" :class="radio == '评论' ? '' : 'hide'">
            <div class="title">发表新的评论</div>

            <div class="publish flex-view">
              <el-avatar
                class="mine-img"
                src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
              />

              <el-input
                v-model="commentInput"
                style="max-width: 600px"
                placeholder="说点什么..."
                class="input-with-select"
              >
                <template #prepend>
                  <el-select
                    v-model="appraise"
                    placeholder="评价"
                    size="large"
                    style="width: 100px"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </template>
              </el-input>

              <el-button
                type="primary"
                size="large"
                @click="sendComment()"
                style="margin-left: 10px"
                >发送</el-button
              >
            </div>
            <div class="tab-view flex-view">
              <div class="count-text">共有{{ pagination.total }}条评论</div>
              <div class="tab-box flex-view" v-if="commentData.length > 0">
                <span
                  :class="sortIndex == 'recent' ? 'tab-select' : ''"
                  @click="sortCommentList('recent')"
                  >最新</span
                >
                <div class="line"></div>
                <span
                  :class="sortIndex != 'recent' ? 'tab-select' : ''"
                  @click="sortCommentList('hot')"
                  >热门</span
                >
              </div>
            </div>
            <div class="comments-list">
              <div class="comment-item" v-for="item in commentData">
                <div class="flex-item flex-view">
                  <el-avatar
                    class="mine-img"
                    src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
                  />
                  <div class="person">
                    <div class="name">{{ item.username }}</div>
                    <div class="time">
                      {{ getFormatTime(item.commentTime, true) }}
                    </div>
                  </div>
                  <div class="float-right">
                    <p @click="likeComment(item.id)" class="recommend">
                      点赞数
                    </p>
                    <p @click="likeComment(item.id)" class="num">
                      {{ item.likeCount }}
                    </p>
                    <p class="moderate-review">
                      {{
                        item.commentLevel == "1"
                          ? "好评"
                          : item.commentLevel == "2"
                            ? "中评"
                            : "差评"
                      }}
                    </p>
                  </div>
                </div>
                <p class="comment-content">{{ item.content }}</p>
              </div>
              <div class="infinite-loading-container">
                <div class="infinite-status-prompt" style="">
                  <div slot="no-results" class="no-results">
                    <div class="pagination">
                      <el-pagination
                        :page-sizes="[2, 5, 20, 40, 50, 100]"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="pagination.total"
                        :default-page-size="pagination.size"
                        @change="onPaginationChange"
                      />
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="recommend" style="">
          <div class="title">热门推荐</div>
          <div class="things">
            <div
              class="thing-item thing-item"
              v-for="item in recommendData"
              @click="handleDetail(item)"
            >
              <div class="img-view"><img :src="item.cover" /></div>
              <div class="info-view">
                <h3 class="thing-name">{{ item.title.substring(0, 12) }}</h3>
                <span>
                  <span class="a-price-symbol">¥</span>
                  <span class="a-price">{{ item.price }}</span>
                </span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <el-dialog
    style="width: 750px; border-radius: 10px"
    v-model="buyDeatailDialog.isVisible"
    :title="buyDeatailDialog.title"
    align-center
  >
    <BuyDetail :pageData="buyDetail"> </BuyDetail>
    <div class="btns-view">
      <button class="btn buy" @click="handleBack">返回</button>
      <button class="btn pay jiesuan" @click="handleBuy(pageData)">结算</button>
    </div>
  </el-dialog>
</template>

<script setup>
import { onMounted, ref, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
import {
  thingPage,
  thingGetById,
  thingRealTimeRecommend,
  thingOfflineRecommend,
} from "@/apis/thing";
import {
  commentPage,
  commentGetById,
  commentAdd,
  commentEdit,
} from "@/apis/user/comment";
import { getFormatTime } from "@/apis/utility";
import { StarFilled, Share, CirclePlusFilled } from "@element-plus/icons-vue";
import { wishGetById, wishEdit, wishAdd } from "@/apis/user/wish";
import {
  collectGetById,
  collectEdit,
  collectAdd,
} from "@/apis/user/collection";
import { watchEffect } from "vue";
import { orderAdd } from "@/apis/user/order";
import BuyDetail from "./BuyDetail.vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { addressGetDefaultAddress } from "@/apis/user/address";

// 标签页s
let tabData = ref(["简介", "评论"]);

const route = useRoute();
const router = useRouter();
// 商品数据
const detailData = ref({});

// 根据商品ID查询商品
const getThingById = async (id) => {
  // console.log(id);
  const result = await thingGetById(id);
  if (result != undefined) {
    detailData.value = result.data;
    // console.log(detailData.value);
  }
};

// 评论数据
const commentData = ref([]);

// 过滤对应的条件
const filter = reactive({
  thingId: route.params.productId,
});

// 搜索输入框搜索条件
const search = reactive({});

// 过滤对应的选项
const filterOptions = reactive({});

// 存储排序字段
const orders = reactive({
  column: "id",
  isAsc: true,
});

// 分页
const pagination = reactive({
  page: 1,
  size: 10,
  total: 0,
});
/**
 * 分页改变函数
 * @param {*} currentPage 当前页
 * @param {*} pageSize 每页条数
 */

const onPaginationChange = (currentPage, pageSize) => {
  pagination.page = currentPage;
  pagination.size = pageSize;
  getComments();
};

// 获取所有评论
const getComments = () => {
  commentPage(
    {
      filter: filter,
      search: search,
      orders: [orders],
    },
    pagination.page,
    pagination.size
  ).then((result) => {
    // console.log(route.params.productId);
    commentData.value = result.data.records;
    pagination.total = result.data.total;
    // console.log(commentData.value);
  });
};

// 一开始就重新请求后端
onMounted(async () => {
  const id = route.params.productId;
  // console.log(id);
  getThingById(id);
  getComments();
  getThings();
});

// 实现标签切换
let radio = ref("简介");

// 点击标签页的触发函数

const onTagChange = (key) => {
  if (key != "评论") {
    radio.value = "简介";
  } else {
    radio.value = "评论";
  }
  // console.log(key);
  getComments();
};

// 评论输入框
const options = [
  {
    value: "1",
    label: "好评",
  },
  {
    value: "2",
    label: "中评",
  },
  {
    value: "3",
    label: "差评",
  },
];

const commentInput = ref("");
// 默认好评
const appraise = ref("1");
// 发送评论
const newComment = ref({
  thingId: route.params.productId,
  content: commentInput,
  commentLevel: appraise,
});

// 发送评论
const sendComment = async () => {
  if (newComment.value.content.length > 0) {
    await commentAdd(newComment.value).then((result) => {
      // console.log(result);
    });

    getComments();
  }
  // console.log(newComment.value.content);
};

// 得到该评论其他字段
const updateComment = ref();

// 喜欢评论
const likeComment = async (id) => {
  try {
    // 等待获取评论信息完成
    const result = await commentGetById(id);
    // 更新评论信息
    updateComment.value = result.data;

    // 增加点赞数并转换回字符串（确保likeCount是可读写的）
    if (
      updateComment.value &&
      typeof updateComment.value.likeCount === "string"
    ) {
      updateComment.value.likeCount = (
        parseInt(updateComment.value.likeCount, 10) + 1
      ).toString();
    } else {
      console.error(
        "likeCount is not a string or updateComment.value is undefined"
      );
    }

    // 保存更新后的评论信息
    const editResult = await commentEdit(updateComment.value);
    // console.log(id, "点赞成功");
  } catch (error) {
    console.error("点赞过程中发生错误:", error);
  }
  // 操作成功后调用getComments刷新评论列表
  getComments();
};

// 热门推荐数据

// 评论排序
const sortIndex = ref({});
const sortCommentList = (method) => {
  if (method == "recent") {
    sortIndex.value = "recent";
    orders.column = "comment_time";
    orders.isAsc = false;
    // console.log(orders.column);
    getComments();
  } else {
    sortIndex.value = "hot";
    // 将字符串比较转化为数值型比较
    orders.column = "CAST(like_count AS UNSIGNED)";
    orders.isAsc = false;
    // console.log(orders.column);
    getComments();
  }
};

// 加入收藏单
// 收藏数据
const collectionData = reactive({});
const addToCollection = async () => {
  const id = route.params.productId;
  collectionData.thingId = id;
  // console.log(collectionData);
  await collectAdd(collectionData).then(() => {
    // console.log(result);
  });
  getThingById(id);
};

// 加入心愿单
// 心愿数据
const wishData = reactive({});
const addToWish = async () => {
  const id = route.params.productId;
  wishData.thingId = id;
  await wishAdd(wishData).then(() => {
    // console.log(result);
  });
  getThingById(id);
};

// 热门推荐
const recommendData = ref([]);

const getThings = async () => {
  const result = await thingRealTimeRecommend();
  recommendData.value = result.data;
  console.log(result);
  console.log("##");
};



// 跳转书籍详情页
const handleDetail = (item) => {
  // console.log(item);
  // console.log(route.params.productId);
  router.push({
    name: "productdetail",
    params: { productId: item.id },
  });
  // console.log(route.params.productId);
};

// 监听路由变化
watchEffect(async () => {
  const id = route.params.productId;
  // console.log(id);
  getThingById(id);
  filter.thingId = id;
  // console.log(filter.thingId);
  getComments();
  getThings();
});

// 查询用户地址
// 用户地址
const userDefaultAddress = reactive({});
const getUserDefaultAddress = async () => {
  const result = await addressGetDefaultAddress();

  if (result != undefined) {
    // userDefaultAddress = result.data;
    Object.assign(userDefaultAddress, result.data);
  }
};

// 实现购买功能
const getAddOrder = async (value) => {
  await orderAdd(value);
};
// 触发购买功能

const handleOrder = async (item) => {
  // 填充订单值

  await getUserDefaultAddress();

  // console.log(userDefaultAddress);

  const newOrder = reactive({});
  newOrder.thingId = item.id;
  newOrder.status = 1;
  newOrder.amount = 1;
  newOrder.remark = "";
  newOrder.price = item.price;
  newOrder.cover = item.cover;
  newOrder.title = item.title;
  newOrder.totalSum = item.price;
  newOrder.provinceName = userDefaultAddress.provinceName;
  newOrder.receiverName = userDefaultAddress.name;
  newOrder.receiverPhone = userDefaultAddress.mobile;
  newOrder.receiverAddress = userDefaultAddress.description;
  newOrder.isDefault = userDefaultAddress.isDefault;
  newOrder.provinceId = userDefaultAddress.provinceId;
  Object.assign(buyDetail, newOrder);
  buyDetailVisible();

  // console.log(buyDetail);
};

const buyDetail = reactive({});

/**
 * 购买详情对话框
 */
const buyDeatailDialog = reactive({
  isVisible: false,
  title: "订单信息确认",
});
// 控制对话框是否显示
const buyDetailVisible = () => {
  buyDeatailDialog.isVisible = true;
  // console.log(scope)
};

// 发起购买
const handleBuy = async () => {
  console.log(buyDetail);
  // await getAddOrder(buyDetail);
  confirmPay();
};

// 关闭对话框
const handleBack = () => {
  buyDeatailDialog.isVisible = false;
};
// 确认付款消息
const confirmPay = async () => {
  ElMessageBox.confirm("进行支付", "Warning", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(async () => {
      // ElMessage({
      //   type: "success",
      //   message: "订单提交并支付成功",
      // });
      // 确认支付
      await getAddOrder(buyDetail);
      buyDeatailDialog.isVisible = false;
    })
    .catch(async () => {
      // ElMessage({
      //   type: "info",
      //   message: "支付取消",
      // });
      // 没有支付
      buyDetail.status = 2;
      await getAddOrder(buyDetail);
      buyDeatailDialog.isVisible = false;
    });
};
</script>

<style scoped lang="less">
.detail-header {
  display: flex;
  align-items: center;
}

.detail-image {
  max-width: 500px;
  height: auto;
  margin-right: 2rem;
  border-radius: 5px;
}

.detail-title {
  font-size: 2rem;
  margin: 0;
}

.detail-price,
.detail-description {
  margin-bottom: 1rem;
}

.hide {
  display: none;
}

.detail-content {
  display: flex;
  flex-direction: column;
  width: 1100px;
  margin: 4px auto;
}

.flex-view {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.hidden-lg {
  display: none !important;
}

.thing-infos-view {
  display: flex;
  margin: 89px 0 40px;
  overflow: hidden;

  .thing-infos {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: flex;
  }

  .mobile-share-box {
    height: 38px;
    background: transparent;
    padding: 0 16px;
    margin: 12px 0;
    font-size: 0;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;

    .state {
      width: 64px;
      height: 24px;
      line-height: 24px;
      background: rgba(70, 132, 226, 0.1);
      border-radius: 2px;
      font-weight: 500;
      font-size: 12px;
      color: #4684e2;
      text-align: center;
    }

    .share-img {
      background: #fff;
      width: 38px;
      height: 38px;
      border-radius: 50%;
      text-align: center;

      img {
        position: relative;
        top: 4px;
        width: 24px;
      }
    }
  }

  .thing-img-box {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 235px;
    flex: 0 0 235px;
    margin: 0 40px 0 0;

    img {
      width: 200px;
      height: 186px;
      display: block;
    }
  }

  .thing-info-box {
    text-align: left;
    padding: 0;
    margin: 0;
  }

  .thing-state {
    height: 26px;
    line-height: 26px;

    .state {
      font-weight: 500;
      color: #4684e2;
      background: rgba(70, 132, 226, 0.1);
      border-radius: 2px;
      padding: 5px 8px;
      margin-right: 16px;
    }

    span {
      font-size: 14px;
      color: #152844;
    }
  }

  .thing-name {
    line-height: 32px;
    margin: 16px 0;
    color: #0f1111 !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    font-style: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
  }

  .translators,
  .authors {
    line-height: 18px;
    font-size: 14px;
    margin: 8px 0;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: flex-start;

    .name {
      color: #315c9e;
      white-space: normal;
    }
  }

  .tags {
    position: absolute;
    bottom: 20px;
    margin-top: 16px;

    .category-box {
      color: #152844;
      font-size: 14px;

      .title {
        color: #787878;
      }
    }
  }

  .thing-counts {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 235px;
    flex: 0 0 235px;
    margin-left: 20px;
  }

  .pointer {
    cursor: pointer;
  }

  .count-item {
    height: 64px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    cursor: pointer;
  }

  .count-img {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 32px;
    flex: 0 0 32px;
    margin-right: 24px;
    font-size: 0;

    img {
      width: 100%;
      display: block;
    }
  }

  .count-box {
    position: relative;
    border-bottom: 1px solid #cedce4;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    height: 100%;
  }

  .count-text-box {
    font-size: 0;

    .count-title {
      color: #152844;
      font-weight: 600;
      font-size: 16px;
      line-height: 18px;
      display: block;
      height: 18px;
    }
  }

  .count-num-box {
    font-weight: 600;
    font-size: 20px;
    line-height: 24px;
    color: #152844;
  }
}

.buy-btn {
  cursor: pointer;
  display: block;
  background: #4684e2;
  border-radius: 4px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  height: 36px;
  line-height: 36px;
  width: 110px;
  outline: none;
  border: none;
  margin-top: 18px;
}

.buy-btn img {
  width: 12px;
  margin-right: 2px;
  vertical-align: middle;
}

.buy-btn span {
  vertical-align: middle;
}

.buy-way {
  overflow: hidden;

  .title {
    font-weight: 600;
    font-size: 18px;
    height: 26px;
    line-height: 26px;
    color: #152844;
    margin-bottom: 12px;
  }
}

.thing-content-view {
  margin-top: 40px;
  padding-bottom: 50px;
}

.main-content {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;

  .text {
    color: #484848;
    font-size: 16px;
    line-height: 26px;
    padding-left: 12px;
    margin: 11px 0;
    white-space: pre-wrap;
  }
}

.main-tab {
  border-bottom: 1px solid #cedce4;
}

.order-view {
  position: relative;
  color: #6c6c6c;
  font-size: 14px;
  line-height: 40px;

  .title {
    margin-right: 8px;
  }

  .tab {
    margin-right: 20px;
    cursor: pointer;
    color: #5f77a6;
    font-size: 16px;
    cursor: pointer;
  }

  .tab-select {
    color: #152844;
    font-weight: 600;
  }

  .tab-underline {
    position: absolute;
    bottom: 0;
    left: 84px;
    width: 16px;
    height: 4px;
    background: #4684e2;
    -webkit-transition: left 0.3s;
    transition: left 0.3s;
  }
}

.recommend {
  -webkit-box-flex: 0;
  -ms-flex: 0 0 235px;
  flex: 0 0 235px;
  margin-left: 20px;

  .title {
    font-weight: 600;
    font-size: 18px;
    line-height: 26px;
    color: #152844;
    margin-bottom: 12px;
  }

  .things {
    border-top: 1px solid #cedce4;

    .thing-item {
      min-width: 255px;
      max-width: 255px;
      position: relative;
      flex: 1;
      margin-right: 20px;
      height: fit-content;
      overflow: hidden;
      margin-top: 26px;
      margin-bottom: 36px;
      padding-bottom: 24px;
      border-bottom: 1px #e1e1e1 solid;
      cursor: pointer;

      .img-view {
        height: 200px;
        width: 255px;

        img {
          height: 200px;
          width: 186px;
          overflow: hidden;
          margin: 0 auto;
          background-size: contain;
          object-fit: contain;
        }
      }

      .info-view {
        overflow: hidden;
        padding: 0 16px;
        .thing-name {
          line-height: 32px;
          margin-top: 12px;
          color: #0f1111 !important;
          font-size: 15px !important;
          font-weight: 400 !important;
          font-style: normal !important;
          text-transform: none !important;
          text-decoration: none !important;
        }

        .price {
          color: #ff7b31;
          font-size: 20px;
          line-height: 20px;
          margin-top: 4px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .translators {
          color: #6f6f6f;
          font-size: 12px;
          line-height: 14px;
          margin-top: 4px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }
  }
}

.flex-view {
  display: flex;
}

.thing-comment {
  .title {
    font-weight: 600;
    font-size: 14px;
    line-height: 22px;
    height: 22px;
    color: #152844;
    margin: 24px 0 12px;
  }

  .publish {
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;

    .mine-img {
      -webkit-box-flex: 0;
      -ms-flex: 0 0 40px;
      flex: 0 0 40px;
      margin-right: 12px;
      border-radius: 50%;
      width: 40px;
      height: 40px;
    }

    .content-input {
      -webkit-box-flex: 1;
      -ms-flex: 1;
      flex: 1;
      background: #f6f9fb;
      border-radius: 4px;
      height: 32px;
      line-height: 32px;
      color: #484848;
      padding: 5px 12px;
      white-space: nowrap;
      outline: none;
      border: 0px;
    }

    .send-btn {
      margin-left: 10px;
      background: #4684e2;
      border-radius: 4px;
      -webkit-box-flex: 0;
      -ms-flex: 0 0 80px;
      flex: 0 0 80px;
      color: #fff;
      font-size: 14px;
      text-align: center;
      height: 32px;
      line-height: 32px;
      outline: none;
      border: 0px;
      cursor: pointer;
    }
  }

  .tab-view {
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    font-size: 14px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin: 24px 0;

    .count-text {
      color: #484848;
      float: left;
    }

    .tab-box {
      color: #5f77a6;
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;

      .tab-select {
        color: #152844;
      }

      span {
        cursor: pointer;
      }
    }

    .line {
      width: 1px;
      height: 12px;
      margin: 0 12px;
      background: #cedce4;
    }
  }
}

.comments-list {
  .comment-item {
    .flex-item {
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      padding-top: 16px;

      .avator {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 40px;
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        margin-right: 12px;
        border-radius: 50%;
        cursor: pointer;
      }

      .person {
        -webkit-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
      }

      .name {
        color: #152844;
        font-weight: 600;
        font-size: 14px;
        line-height: 22px;
        height: 22px;
        cursor: pointer;
      }

      .time {
        color: #5f77a6;
        font-size: 12px;
        line-height: 16px;
        height: 16px;
        margin-top: 2px;
      }

      .float-right {
        color: #4684e2;
        font-size: 14px;
        float: right;
        padding: 10px;

        .recommend {
          margin-left: 19px;
          cursor: pointer;
        }

        .num {
          color: #152844;
          margin-left: 6px;
          margin-top: 10px;
          text-align: center;
          cursor: pointer;
        }

        .moderate-review {
          color: orange;
          font-weight: 500;
          margin-left: 6px;
          margin-top: 10px;
          text-align: center;
          cursor: auto;
        }
      }
    }
  }
}

.comment-content {
  margin-top: 8px;
  color: #484848;
  font-size: 14px;
  line-height: 22px;
  padding-bottom: 16px;
  border-bottom: 1px dashed #cedce4;
  margin-left: 52px;
  overflow: hidden;
  word-break: break-word;
}

.infinite-loading-container {
  clear: both;
  text-align: center;
}

.a-price-symbol {
  top: -0.5em;
  font-size: 12px;
}
.a-price {
  color: #0f1111;
  font-size: 21px;
}
/**
自定义样式
*/

.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.btns-view {
  margin-top: 24px;
  text-align: right;

  .buy {
    background: #fff;
    color: #4684e2;
  }

  .jiesuan {
    cursor: pointer;
    background: #4684e2;
    color: #fff;
  }

  .btn {
    cursor: pointer;
    width: 96px;
    height: 36px;
    line-height: 33px;
    margin-left: 16px;
    text-align: center;
    border-radius: 32px;
    border: 1px solid #4684e2;
    font-size: 16px;
    outline: none;
  }
}
</style>
